package com.common.project.table;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Date;

/**
 * @author jiang shicun
 * @date 2018-11-24
 */
@Entity
@Data
@Table(name = "log")
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@org.hibernate.annotations.Table(appliesTo = "log",comment="日志表")
public class Log extends Model<Log> implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 操作用户
     */
    @Column(name = "username",columnDefinition = "varchar(50) DEFAULT '' COMMENT '操作用户'")
    private String username;

    /**
     * 代码作者名称
     */
    @Column(name = "coder_author",columnDefinition = "varchar(50) DEFAULT '' COMMENT '代码作者名称'")
    private String coderAuthor;

    /**
     * 代码作者邮箱
     */
    @Column(name = "coder_email",columnDefinition = "varchar(50) DEFAULT '' COMMENT '代码作者邮箱'")
    private String coderEmail;

    /**
     * 描述
     */
    @Column(name = "description",columnDefinition = "varchar(50) DEFAULT '' COMMENT '描述'")
    private String description;

    /**
     * 方法名
     */
    @Column(name = "method",columnDefinition = "varchar(500) DEFAULT '' COMMENT '方法名'")
    private String method;

    /**
     * 参数
     */
    @Column(name = "text",columnDefinition = "text  COMMENT '参数'")
    private String params;

    /**
     * 日志类型
     */
    @Column(name = "log_type",columnDefinition = "varchar(50) DEFAULT '' COMMENT '日志类型'")
    private String logType;

    /**
     * 请求ip
     */
    @Column(name = "request_ip",columnDefinition = "varchar(50) DEFAULT '' COMMENT '请求ip'")
    private String requestIp;

    /**
     * 请求耗时
     */
    private Long time;

    /**
     * 异常详细
     */
    @Column(name = "exception_detail", columnDefinition = "text  COMMENT '异常详细'")
    private byte[] exceptionDetail;

    /**
     * 创建日期
     */
    @CreationTimestamp
    @Column(name = "create_time",columnDefinition = "datetime DEFAULT NULL COMMENT '创建时间'")
    private Date createTime;


}
